Post

Replies

Boosts

Views

Activity

Reply to How to use NavigationSplitView instead of NavigationView where binding was used
I was able to work around this by making a wrapper struct for the binding that conforms to Hashable if the value is Hashable. Then I am able to do the following in the NavigationLink: NavigationLink(value: HashableBindingWrapper<Event>(binding: $event) { … } // Later in file: .navigationDestination(for: HashableBindingWrapper<Event>.self) { wrapper in EventEditor(event: wrapper.binding) } It's ugly to need to do this instead of it being supported directly, but it seems to work. Thanks to Ben Scheirman for the suggestion. Here's the code for HashableBindingWrapper: struct HashableBindingWrapper<Value> {     let binding: Binding<Value> } extension HashableBindingWrapper: Equatable where Value: Equatable {     static func == (lhs: HashableBindingWrapper<Value>, rhs: HashableBindingWrapper<Value>) -> Bool {         lhs.binding.wrappedValue == rhs.binding.wrappedValue     } } extension HashableBindingWrapper: Hashable where Value: Hashable {     func hash(into hasher: inout Hasher) {         hasher.combine(binding.wrappedValue.hashValue)     } }
Jul ’22
Reply to Is it possible to save a screenshot of a preview in Xcode 14?
In this case, I wanted to quickly send a screen shot of my work-in-progress to someone. As I mentioned, I could take a regular screen shot (and did), but having to crop the image is definitely a point of friction. I could also imagine using screen shots to try out different layouts, taking a screenshot of each to show to others to compare. I would imagine pretty much everything people use Simulator screenshots for would also be a use case for Xcode Preview screenshots, with the added advantage that Xcode Preview screenshots could be easily created subsets of the UI, not just the entire app.
Nov ’22